<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<script src="../../scripts/ace-template.js"></script>
		<script src="http://code.jquery.com/jquery-latest.js"></script>
		<title>ace template examples</title>
	</head>
	<body>
		<h3>今日电影排行榜</h3>
		<ul>
			<script id="t1" type="text/template">
				$.each(this, function(i, item) {
					<li>
						<b>第#{i + 1}名</b><a href="#{item.url}" target="blank">#{item.title}</a>
						if (item.isnew) {
							<span>new!</span>
						}
					</li>
				});
			</script>
		</ul>
		<script>
			(function() {
				// from http://top.baidu.com/buzz.php?p=movie
				var movieList = [
					{
						title: "建党伟业",
						url: "http://top.baidu.com/detail.php?b=26&w=%BD%A8%B5%B3%CE%B0%D2%B5"
					},
					{
						title: "变形金刚3",
						url: "http://top.baidu.com/detail.php?b=26&w=%B1%E4%D0%CE%BD%F0%B8%D53",
						isnew: true
					},
					{
						title: "功夫熊猫2",
						url: "http://top.baidu.com/detail.php?b=26&w=%B9%A6%B7%F2%D0%DC%C3%A82"
					},
					{
						title: "加勒比海盗4",
						url: "http://top.baidu.com/detail.php?b=26&w=%BC%D3%C0%D5%B1%C8%BA%A3%B5%C14"
					},
					{
						title: "3d肉蒲团",
						url: "http://top.baidu.com/detail.php?b=26&w=3d%C8%E2%C6%D1%CD%C5"
					}
				];			

				$(":has(>#t1)").html(AceTemplate.format('t1', movieList));
			})();
		</script>
	</body>
</html>